<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type='text/javascript'
			src="<s:url value="/js/ptTimeSelect/jquery.ptTimeSelect.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/ptTimeSelect/jquery.ptTimeSelect.css"/>" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery.form.js"/>"></script>
		<script type="text/javascript"
			src="<s:url value="/js/jquery.validate.js"/>"></script>
		<script type="text/javascript">
				function doSubmit() {
					// here is validate form .
					$('#editForm').submit();
				}
				function goBack() {
					location.href = '<s:url value="/clt/CorpCC/list"/>';
				}
				function leadsStatusControl(){
					var cr = ['Invalid','Pay','Dead'];
					var l = document.getElementById('leadsStatus');
					for(var i = l.options.length-1 ;i>0;i--){
						switch(l.options[i].value){
						case 'Invalid':
							break;
						case 'Pay':
							break;
						case 'Dead':
							break;
						default:
							 l.remove(i);
						}
					}
				}
				$( function() {
				    $('#editForm').validate();
					$('#initVisitTime').datepicker( {
						dateFormat :'yy-mm-dd'
					});
					$('#depositTime').datepicker( {
						dateFormat :'yy-mm-dd'
					});
					if ($.trim($('#result').text()) != '') {
						popupDiv('pop-div');
					};
					  $('#todoEventDate').datepicker( {
						dateFormat :'yy-mm-dd'
				      });
			          $('#todoEventTime').ptTimeSelect();
				});
				function goCall(tel) {
					if (!tel){
					   return ;
					}
					$('#currentCalltelephone').val(tel);
					var d=new Date();
					$('#currentCalldealTime').val(d.format("isoDate")+" "+d.format("isoTime"));
				};
			</script>
	<title><s:text name="system.title" /></title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td id="tag-over">
								<span id="tag-over">Call</span>
							</td>
							<td class="tab3-line" width="90%">
								&nbsp;
							</td>
						</tr>
					</table>
					<s:form action="CorpCC/saveCall" namespace="/clt" method="post"
						id="editForm" name="editForm">
						<s:hidden name="id"></s:hidden>
						<table width="100%" border="0" cellpadding="0" cellspacing="1"
							class="margin">
							<tr>
								<td align="right" class="tablecolour5">
									Name
									<font color="red">*</font>:
								</td>
								<td class="tablecolour5">
									<s:textfield name="name" cssClass="input2 required" size="24" />
								</td>
								<td align="right" class="tablecolour5">
									Fax:
								</td>
								<td class="tablecolour5">
									<s:textfield name="fax" cssClass="input2" size="24" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Contactor:
								</td>
								<td class="tablecolour5">
									<s:textfield name="contactor" cssClass="input2" size="24" />
								</td>
								<td align="right" class="tablecolour5">
									E-Mail:
								</td>
								<td class="tablecolour5">
									<s:textfield name="email" cssClass="input2" size="24" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Address:
								</td>
								<td class="tablecolour5">
									<s:textfield name="address" cssClass="input2" size="24" />
								</td>
								<td align="right" class="tablecolour5">
									Post Code:
								</td>
								<td class="tablecolour5">
									<s:textfield name="postCode" cssClass="input2" size="24" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Initial Visit:
								</td>
								<td class="tablecolour5">
									<s:date name="initialVisitTime" format="yyyy-MM-dd"
										var="initialVisitTimefmt" />
									<s:textfield value="%{initialVisitTimefmt}"
										name="initialVisitTime" cssClass="input2" size="24"
										id="initialVisitTime" />
								</td>
								<td align="right" class="tablecolour5">
									Oppt Time:
								</td>
								<td class="tablecolour5">
									<s:date name="opptTime" format="yyyy-MM-dd" var="opptTimefmt" />
									<s:textfield value="%{opptTimefmt}" name="opptTime"
										cssClass="input2" size="24" id="opptTime" />
								</td>
							</tr>
							<tr>
								<td align="center" colspan="4" height="50" class="tablecolour5">
									<input type="button" class="btn1" value="Save"
										onclick="doSubmit();" />
									<input name="goback" type="button" class="btn1" value="Go Back"
										onclick="goBack()" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Telephone:
									<img
										onclick="javascript:goCall('<s:property value="telephone" />');"
										style="cursor: pointer"
										src="<s:url value="/img/right/call.gif"/>" border="0"
										align="absmiddle" />
								</td>
								<td class="tablecolour5">
									<s:textfield name="telephone" cssClass="input2" size="15" />
								</td>
								<td align="right" class="tablecolour5">
									Last Comments:
								</td>
								<td class="tablecolour5" colspan="7">
									<s:textarea name="lastEventCommons" cols="60" rows="6" />
								</td>
							</tr>
						</table>
						<table cellpadding="3" cellspacing="1" width="100%"
							style="margin-top: 1px;" class="margin">
							<tr>
								<td colspan="8" class="title">
									CC Calling....
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Stage:
								</td>
								<td class="tablecolour5">
									<s:select name="stage" listKey="name()"
										list="@com.ef.constant.EStageType@values()" />
								</td>
								<td class="tablecolour5">
									Calling....:
									<s:textfield id="currentCalltelephone"
										name="currentCallTelephone" cssClass="input2" size="15" />
									<s:hidden name="currentCallId" />
									Status:
									<s:select name="currentCallStatus" headerKey=""
										headerValue="--select--"
										list="@com.ef.constant.ECallStatus@values()" listKey="name()" />
									<br />
									At:
									<s:date name="currentCallDealTime" format="yyyy-MM-dd HH:mm:ss"
										var="dealTimefmt" />
									<s:textfield name="currentCallDealTime" cssClass="input2"
										size="30" id="currentCalldealTime" value="%{dealTimefmt}"
										readonly="true" />
								</td>
								<td class="tablecolour5" align="right">
									Comments:
								</td>
								<td class="tablecolour5" align="left">
									<s:textarea name="currentCallComments" cssClass="input2"
										rows="3" cols="30" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Next Task:
								</td>
								<td class="tablecolour5">
									<s:select name="todoEventType"
										list="@com.ef.constant.EUserTodoType@values()"
										listKey="name()" />
									<s:hidden name="todoEventId" />
								</td>
								<td class="tablecolour5">
									Date:
									<s:textfield id="todoEventDate" name="todoEventDate"
										cssClass="input2" size="15" />
									Time:
									<s:textfield id="todoEventTime" name="todoEventTime"
										cssClass="input2" size="15" />
								</td>
								<td class="tablecolour5" align="right">
									Comments:
								</td>
								<td class="tablecolour5" align="left">
									<s:textarea name="todoEventComments" cssClass="input2" rows="2"
										cols="30" />
								</td>
							</tr>
							<tr>
								<td align="center" colspan="8" height="50" class="tablecolour5">
									<input type="button" class="btn1" value="Save"
										onclick="doSubmit();" />
									<input name="goback" type="button" class="btn1" value="Close"
										onclick="window.close()" />
								</td>
							</tr>
						</table>
						<table cellpadding="3" cellspacing="1" width="100%"
							style="margin-top: 5px;" class="margin">
							<tr>
								<td colspan="5" class="title">
									Event History
								</td>
							</tr>
							<tr>
								<td class="tablecolour5">
									Task Type
								</td>
								<td class="tablecolour5">
									Call Number
								</td>
								<td class="tablecolour5">
									Call Time
								</td>
								<td class="tablecolour5">
									Comment
								</td>
								<td class="tablecolour5">
									Call Status
								</td>
							</tr>
							<s:iterator value="calls">
								<tr>
									<td class="tablecolour5">
										<s:property value="eventType" />
									</td>
									<td class="tablecolour5">
										<s:property value="telephone" />
									</td>
									<td class="tablecolour5">
										<s:date name="dealTime" format="yyyy-MM-dd HH:mm" />
									</td>
									<td class="tablecolour5">
										<s:property value="comments" />
									</td>
									<td class="tablecolour5">
										<s:property value="callStatus" />
									</td>
								</tr>
							</s:iterator>
						</table>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
		<div id='pop-div' style="width: 300px;" class="pop-box">
			<s:include value="/common/confirmPopup.jsp"></s:include>
		</div>
	</body>
</html>